<template>
  <div>
    <!-- 01:联合体企业、02:普通企业、03:中介机构、04:服务机构、05：联合体子企业 -->
    <div class="personalLeft" style="min-height:600px;">
      <el-menu 
      :default-active="$route.path"
      class="el-menu-vertical-demo" 
      background-color="transparent" 
      text-color="#fff"
        @select="handleSelect" 
        :unique-opened="true"
        active-text-color="#033899" 
        router>
        <menuTree :menus="leftMenuList"></menuTree>
      </el-menu>
    </div>
  </div>
</template>
<script>
import { getUserMenu } from "@/request/api/link"
import menuTree from "./meunTree.vue"
export default {
  components:{
    menuTree
  },
  data() {
    return {
      activeIndex: "",
      mapName: "",
      userInfo: {},
      leftMenuList:[]
    };
  },
  mounted() {
    this.activeIndex = this.$route.path;
    // this.$emit('getMenu', this.activeIndex)
  },
  created() {
    this.getInfo()
    this.getMenu()
  },
  methods: {
    handleSelect(key) {
      this.$router.push(key)
      // this.$emit('getMenu', key)
    },
    getInfo() {
      var userInfo = JSON.parse(window.sessionStorage.getItem("userInfo"));
      this.userInfo = userInfo
    },
    // 获取菜单
    getMenu() {
      getUserMenu().then(res => {
        if (res.data.code === 200) {
          this.leftMenuList = res.data.result;
          // this.menuPath = window.sessionStorage.getItem("menuPath") || "/index";
        }
      })
    }
  },
};
</script>
<style lang="less" scoped>
@import "./leftMenu.less";
.el-menu {
    border-right:0; 
    list-style: none;
    position: relative;
    margin: 0;
    padding-left: 0;
    background-color: #FFF;
}
</style>
